import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/rb-oem/oem/merrecord/mer_change_record/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

/* 商户新增变更详情 */
export const getDetail = (rpiNo, changeType) => {
  return request({
    // url: '/api/rb-oem/oem/merrecord/mer_change_record/detail',
    url: '/api/rb-oem/oem/merrecord/mer_change_record/detailRecord',
    method: 'get',
    params: {
      rpiNo,
      changeType
    }
  })
}

/* 商户新增变更详情 v2.0.0 */
export const getDetailRecord = (params) => {
  return request({
    url: '/api/rb-oem/oem/merrecord/mer_change_record/detailRecordPlus',
    method: 'get',
    params
  })
}

/* 商户修改变更 工作流详情 */
export const getDetailProcess = (id) => {
  return request({
    url: '/api/rb-oem/oem/merrecord/mer_change_record/detailProcess',
    method: 'get',
    params: {
      id
    }
  })
}

/* 商户修改、审核变更详情 */
export const getDetailPlus = (changeNo) => {
  return request({
    url: '/api/rb-oem/oem/merrecord/mer_change_record/detailFlowPlus',
    method: 'get',
    params: {
      changeNo
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/rb-oem/oem/merrecord/mer_change_record/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/rb-oem/oem/merrecord/mer_change_record/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/rb-oem/oem/merrecord/mer_change_record/submit',
    method: 'post',
    data: row
  })
}

export const addMerRecord = (row) => {
  return request({
    // url: '/api/rb-oem/oem/merrecord/mer_change_record/insertMerRecord',
    url: '/api/rb-oem/oem/merrecord/mer_change_record/insertMerChangePlus',
    method: 'post',
    data: row
  })
}

export const updateMerRecord = (row) => {
  return request({
    url: '/api/rb-oem/oem/merrecord/mer_change_record/updateMerRecord',
    method: 'post',
    data: row
  })
}

/* 变更 驳回编辑 */
export const updateMerRecordReject = (row) => {
  return request({
    url: '/api/rb-oem/oem/merrecord/mer_change_record/updateMerRecordReject',
    method: 'post',
    data: row
  })
}

/* 编辑 变更单走工作流 */
export const completeProcess = (row) => {
  return request({
    url: '/api/rb-oem/oem/merrecord/mer_change_record/completeProcess',
    method: 'post',
    data: row
  })
}

/* 驳回记录 */
export const getRejectList = (id) => {
  return request({
    url: '/api/rb-oem/oem/merrecord/mer_change_record/selectRejectList',
    method: 'get',
    params: {
      id,
    }
  })
}

/* 提交审核 */
export const auditMerRecord = (row) => {
  return request({
    url: '/api/rb-oem/oem/merrecord/mer_change_record/adminMerRecord',
    method: 'post',
    data: row
  })
}

/* 商户修改、审核变更详情 */
export const getDetailFlowPlus = (changeNo) => {
  return request({
    // url: '/api/rb-oem/oem/merrecord/mer_change_record/detailPlus',
    url: '/api/rb-oem/oem/merrecord/mer_change_record/detailFlowPlus',
    method: 'get',
    params: {
      changeNo
    }
  })
}